package com.sharemarking.wa.platform.controller;

import com.sharemarking.wa.common.ResponseParams;
import com.sharemarking.wa.platform.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dxy
 */
@RestController
@RequestMapping(value = "address")
public class AddressController {
    @Autowired
    AddressService addressService;

    /**
     * 获取我的地址列表
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getAddressList")
    public ResponseParams<?> getAddressList() throws Exception {
        return addressService.getAddressList();
    }


    /**
     * 新增或编辑地址
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "addOrEditAddress")
    public ResponseParams<?> addOrEditAddress() throws Exception {
        return addressService.addOrEditAddress();
    }

    /**
     * 删除地址
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "deleteAddress")
    public ResponseParams<?> deleteAddress() throws Exception {
        return addressService.deleteAddress();
    }


    /**
     * 获取地址信息
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getAddressInfo")
    public ResponseParams<?> getAddressInfo() throws Exception {
        return addressService.getAddressInfo();
    }


    /**
     * 设置默认地址
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "setAddressDefault")
    public ResponseParams<?> setAddressDefault() throws Exception {
        return addressService.setAddressDefault();
    }
}
